<?php

	class Conection {
		
		static $dblink;
		public $row;
		private function Conection($host='localhost',$dataBase='dirdomestico',$user='root',$pass=''){
		//public function Conection($host='200.234.202.102',$dataBase='empregadordome',$user='empregadordome',$pass='ddom..8002'){
		
						
			
			if (!$this->dblink) {
				$this->dblink = mysql_connect($host, $user,$pass);
				if (!mysql_select_db($dataBase, $this->dblink)) {
					mysql_close($this->dblink);
					unset($this->dblink);																
				}
			}
			
		}
		
		static function getConexao(){
			if (!isset( $this->dblink)) {
				return new Conection();
			}
		}
		
		public function executeQuery($sql) {
			
			$res = mysql_query(htmlspecialchars(trim($sql)	, $this->dblink);
			$n_linhas=mysql_affected_rows();
	
			if($n_linhas==0)
				return $n_linhas;
	
			return $res;
		}
		
		public function executeUpdate($sql){
			$a= mysql_query(htmlspecialchars(trim($sql)	,$this->dblink);
			return mysql_affected_rows();
		}
	
		public function close(){
			mysql_close($this->dblink);
			unset($this->dblink);
		}
	
	
	}
	


?>